package com.microservices.yucloud.api.service;

import com.microservices.yucloud.api.entity.Email;
import com.microservices.yucloud.api.queue.WorkerQueue;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

/**
 * @author zy
 * @date 2019-08-14 17:38
 **/
@Slf4j
@Service
public class WorkerService {

    @Async
    public void sendQueue(Email mail) throws Exception {
        log.info("生产消息[Email]:{}", mail.getSubject());
        WorkerQueue.getMailQueue().produce(mail);
    }
}
